package ${servicePackage}.controller.web;

import ${pojoPackage}.param.${classOtherName}.*;
import ${pojoPackage}.vo.${classOtherName}.*;
import ${servicePackage}.service.in.*;
import ${corePackage}.domains.vo.PageResult;
import ${corePackage}.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

import java.util.List;

/**
*   web/${entityName}
* 【描 述】：
* 【环 境】：J2SE
* 【详 细】：
*
*/
@RestController
@RequestMapping("/${classOtherName}/web")
public class ${className}WebController {

private final ${className}Service service;

public ${className}WebController(${className}Service service) {
this.service = service;
}


/**
* 创建${entityName}
* @param param
* @return
*/
@PostMapping("/create${className}")
public ApiResult create${className}(@RequestBody @Valid Create${className}Param param){
service.create${className}(param);
return ApiResult.ok();
}


/**
* 修改${entityName}
* @param param
*/
@PutMapping("/edit${className}")
public ApiResult edit${className}(@RequestBody @Valid Edit${className}Param param){
service.edit${className}(param);
return ApiResult.ok();
}

/**
* 移除${entityName}
* @param id
*/
@DeleteMapping("/remove${className}")
public ApiResult remove${className}(@RequestParam("id") Long id){
service.remove${className}(id);
return ApiResult.ok();
}

/**
* 启动/禁用${entityName}
* @param id
*/
@GetMapping("/enabled${className}")
public ApiResult enabled${className}(@RequestParam("id") Long id){
service.enabled${className}(id);
return ApiResult.ok();
}

/**
* 获取${entityName}详情
* @param id
* @return
*/
@GetMapping("/get${className}")
public ApiResult< Get${className}Vo> get${className}(@RequestParam("id") Long id){
Get${className}Vo vo = service.get${className}(id);
return ApiResult.ok(vo);
}

/**
* 获取${entityName}列表
* @param param
* @return
*/
@PostMapping("/get${className}List")
public ApiResult< PageResult< Get${className}ListVo>> get${className}List(@RequestBody Get${className}ListParam param){
PageResult< Get${className}ListVo> result = service.get${className}List(param);
return ApiResult.ok(result);
}


/**
* 获取${entityName}下拉列表
*
* @return
*/
@PostMapping("/get${className}DownList")
public ApiResult< List< Get${className}DownListVo > > get${className}DownList(@RequestBody(required = false) @Valid Get${className}DownListParam param) {
List< Get${className}DownListVo > list = service.get${className}DownList(param);
return ApiResult.ok(list);
}


}

